﻿using System;
using System.Windows;
using TheVerge.Base.Platform;

namespace TheVerge.Phone.Imp {
	public class PhoneUIThread : IUIThread {

		#region IUIThread Members

		public void Invoke(Action a) {
			if (Deployment.Current.Dispatcher.CheckAccess())
				a();
			else
				Deployment.Current.Dispatcher.BeginInvoke(a);
		}

		public Action Wrap(Action a) {
			return () => Invoke(a);
		}

        public void ShowMessage(string message)
        {
            Invoke(() => MessageBox.Show(message));
        }

		#endregion
	}
}
